/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 */

import { NewAppScreen } from '@react-native/new-app-screen';
import { Button, StatusBar, StyleSheet, Text, useColorScheme, View } from 'react-native';
import ChildCom from './ChildCom';

function App() {
  const isDarkMode = useColorScheme() === 'dark';
  const isLogin = true

  return (
    <View style={styles.container}>
        <Text>啊哈哈</Text>
        <Text>{isLogin && <Button title='登录'></Button>}</Text>
        {/* 函数引用子组件 */}
        <View>{App2()}</View>
        {/* 子组件引用APP2 */}
        <App2 />
        {/*引用外界子组件 */}
        <ChildCom />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    marginTop:StatusBar.currentHeight || 50,
    padding:20
  },
});
// 列表渲染2中
export function App2() { 
  const listData = ['酒店','景点','美食']
  return(
<View> 
    {
      listData.map((item,index)=>{
      return <Text key={index} style={{margin:20}}>{item}</Text>
    }) 
    }
</View>
  );
}
export default App;
